Title: SQL W3S (By-BKK) / 008 OR
Tags: Obsidian_to_Anki

Q: What does the OR operator do in SQL WHERE clause?
A: Returns records if any of the specified conditions are true

Q: True/False: OR can be combined with AND in SQL queries
A: True

Q: How do you select all customers from Germany or Spain?
A: SELECT * FROM Customers WHERE Country='Germany' OR Country='Spain'

Q: What is the difference between OR and AND in SQL?
A: OR requires at least one condition to be true, AND requires all conditions to be true

Q: How can you use parenthesis with OR and AND for correct results?
A: Group OR conditions inside parenthesis with AND

Q: What happens if you forget parenthesis when mixing AND and OR?
A: SQL may not filter results as intended

Q: How do you select Spanish customers whose name starts with 'G' or 'R'?
A: SELECT * FROM Customers WHERE Country='Spain' AND (CustomerName LIKE 'G%' OR CustomerName LIKE 'R%')

Q: True/False: The OR operator can be used with more than two conditions
A: True

Q: What is an example of selecting by multiple OR conditions?
A: SELECT * FROM Customers WHERE City='Berlin' OR CustomerName LIKE 'G%' OR Country='Norway'

Q: Returns records if any of the specified conditions are true
A: What does the OR operator do in SQL WHERE clause?

Q: True
A: Can OR and AND be combined in SQL queries?

Q: SELECT * FROM Customers WHERE Country='Germany' OR Country='Spain'
A: How do you select all customers from Germany or Spain?

Q: OR requires at least one condition to be true, AND requires all to be true
A: What is the difference between OR and AND in SQL?

Q: SQL may not filter results as intended
A: What happens if you forget parenthesis when mixing AND and OR?